'****************************************************************************'
'                                                                            '
' Copyright (C) 2010 Muhammad alaa                                           '
'                                                                            '
' This program is free software; you can redistribute it and/or modify       '
' it under the terms of the GNU General Public License as published by       '
' the Free Software Foundation; either version 2 of the License, or          '
' (at your option) any later version.                                        '
'                                                                            '
' This program is distributed in the hope that it will be useful,            '
' but WITHOUT ANY WARRANTY; without even the implied warranty of             '
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              '
' GNU General Public License for more details.                               '
'                                                                            '
' You should have received a copy of the GNU General Public License along    '
' with this program; if not, write to the Free Software Foundation, Inc.,    '
' 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.                '
'                                                                            '
'****************************************************************************'

Public Structure OpenFileNameA
    Public lStructSize As UInteger
    Public hwndOwner As IntPtr
    Public hInstance As IntPtr
    <MarshalAs(UnmanagedType.LPStr)> _
    Public lpstrFilter As String
    <MarshalAs(UnmanagedType.LPStr)> _
    Public lpstrCustomFilter As String
    Public nMaxCustFilter As UInteger
    Public nFilterIndex As UInteger
    <MarshalAs(UnmanagedType.LPStr)> _
    Public lpstrFile As String
    Public nMaxFile As UInteger
    <MarshalAs(UnmanagedType.LPStr)> _
    Public lpstrFileTitle As String
    Public nMaxFileTitle As UInteger
    <MarshalAs(UnmanagedType.LPStr)> _
    Public lpstrInitialDir As String
    <MarshalAs(UnmanagedType.LPStr)> _
    Public lpstrTitle As String
    Public Flags As OpenFileDialogFlags
    Public nFileOffset As UShort
    Public nFileExtension As UShort
    <MarshalAs(UnmanagedType.LPStr)> _
    Public lpstrDefExt As String
    Public lCustData As IntPtr
    Public lpfnHook As OpenFileDialogHookDelegate
    <MarshalAs(UnmanagedType.LPStr)> _
    Public lpTemplateName As String
    Public pvReserved As IntPtr
    Public dwReserved As UInteger
    Public FlagsEx As OpenFileDialogFlagsEx
End Structure

Public Structure OpenFileNameW
    Public lStructSize As UInteger
    Public hwndOwner As IntPtr
    Public hInstance As IntPtr
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public lpstrFilter As String
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public lpstrCustomFilter As String
    Public nMaxCustFilter As UInteger
    Public nFilterIndex As UInteger
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public lpstrFile As String
    Public nMaxFile As UInteger
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public lpstrFileTitle As String
    Public nMaxFileTitle As UInteger
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public lpstrInitialDir As String
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public lpstrTitle As String
    Public Flags As OpenFileDialogFlags
    Public nFileOffset As UShort
    Public nFileExtension As UShort
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public lpstrDefExt As String
    Public lCustData As IntPtr
    Public lpfnHook As OpenFileDialogHookDelegate
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public lpTemplateName As String
    Public pvReserved As IntPtr
    Public dwReserved As UInteger
    Public FlagsEx As OpenFileDialogFlagsEx
End Structure

Public Structure MetaFilePict
    Public mm As Integer
    Public xExt As Integer
    Public yExt As Integer
    Public hMF As IntPtr
End Structure

Public Structure Rect
    Public left As Integer
    Public top As Integer
    Public right As Integer
    Public bottom As Integer
End Structure

Public Structure PaletteEntry
    Public Red As Byte
    Public Green As Byte
    Public Blue As Byte
    Public Flags As PaletteEntryFlags
End Structure

Public Structure LogPalette
    Public Version As UInteger
    Public NumEntries As UInteger
    <MarshalAs(UnmanagedType.LPArray, SizeConst:=1)> _
    Public PalEntry() As PaletteEntry
End Structure

Public Structure FontDesc
    Public cbSizeofstruct As UInteger
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public lpstrName As String
    Public cySize As Long
    Public sWeight As Short
    Public sCharset As Short
    <MarshalAs(UnmanagedType.Bool)> _
    Public fItalic As Boolean
    <MarshalAs(UnmanagedType.Bool)> _
    Public fUnderline As Boolean
    <MarshalAs(UnmanagedType.Bool)> _
    Public fStrikethrough As Boolean
End Structure

Public Structure PicDesc
    Public cbSizeofstruct As UInteger
    Public picType As PicType
    Public Handle As IntPtr
End Structure

Public Structure CADword
    Public cElems As UInteger
    <MarshalAs(UnmanagedType.LPArray)> _
    Public pElems() As UInteger
End Structure

Public Structure CAlpOleStr
    Public cElems As UInteger
    <MarshalAs(UnmanagedType.LPArray, ArraySubType:=UnmanagedType.LPWStr)> _
    Public pElems() As String
End Structure

Public Structure CAUUID
    Public cElems As UInteger
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public pElems() As Guid
End Structure

Public Structure Accel
    Public fVirt As Byte
    Public key As UShort
    Public cmd As UShort
End Structure

Public Structure ControlInfo
    Public cb As UInteger
    <MarshalAs(UnmanagedType.LPArray)> _
    Public hAccel() As Accel
    Public cAccel As UShort
    Public dwFlags As UInteger
End Structure

Public Structure OCPFIParams
    Public cbStructSize As UInteger
    Public hWndOwner As IntPtr
    Public x As Integer
    Public y As Integer
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public lpszCaption As String
    Public cObjects As UInteger
    <MarshalAs(UnmanagedType.LPArray, ArraySubType:=UnmanagedType.IUnknown)> _
    Public lplpUnk() As Object
    Public cPages As UInteger
    <MarshalAs(UnmanagedType.LPArray)> _
    Public lpPages() As Guid
    Public lcid As UInteger
    Public dispidInitialProperty As Integer
End Structure

Public Structure PageRange
    Public nFromPage As Integer
    Public nToPage As Integer
End Structure

Public Structure PageSet
    Public cbStruct As UInteger
    <MarshalAs(UnmanagedType.Bool)> _
    Public fOddPages As Boolean
    <MarshalAs(UnmanagedType.Bool)> _
    Public fEvenPages As Boolean
    Public cPageRange As UInteger
    <MarshalAs(UnmanagedType.LPArray, SizeConst:=1)> _
    Public rgPages() As PageRange
End Structure

Public Structure PropPageInfo
    Public cb As UInteger
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public pszTitle As String
    Public size As Size
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public pszDocString As String
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public pszHelpFile As String
    Public dwHelpContext As UInteger
End Structure

Public Structure QAContainer
    Public cbSize As UInteger
    Public pClientSite As IOLE.IOleClientSite
    Public pAdviseSink As IOLE.IAdviseSinkEx
    Public pPropertyNotifySink As IOLE.IPropertyNotifySink
    <MarshalAs(UnmanagedType.IUnknown)> _
    Public pUnkEventSink As Object
    Public dwAmbientFlags As QAContainerFlags
    Public colorFore As Integer
    Public colorBack As Integer
    Public pFont As IOLE.IFont
    Public pUndoMgr As IOLE.IOleUndoManager
    Public dwAppearance As UInteger
    Public LCID As Integer
    Public hPal As IntPtr
    Public pBindHost As IE.IBindHost
    Public pOleControlSite As IOLE.IOleControlSite
    Public pServiceProvider As IServiceProvider
End Structure

Public Structure QAControl
    Public cbSize As UInteger
    Public dwMiscStatus As UInteger
    Public dwViewStatus As UInteger
    Public dwEventCookie As UInteger
    Public dwPropNotifyCookie As UInteger
    Public dwPointerActivationPolicy As UInteger
End Structure

Public Structure TextMetricW
    Public tmHeight As Integer
    Public tmAscent As Integer
    Public tmDescent As Integer
    Public tmInternalLeading As Integer
    Public tmExternalLeading As Integer
    Public tmAveCharWidth As Integer
    Public tmMaxCharWidth As Integer
    Public tmWeight As Integer
    Public tmOverhang As Integer
    Public tmDigitizedAspectX As Integer
    Public tmDigitizedAspectY As Integer
    Public tmFirstChar As Char
    Public tmLastChar As Char
    Public tmDefaultChar As Char
    Public tmBreakChar As Char
    Public tmItalic As Byte
    Public tmUnderlined As Byte
    Public tmStruckOut As Byte
    Public tmPitchAndFamily As Byte
    Public tmCharSet As Byte
End Structure

Public Structure TextMetricA
    Public tmHeight As Integer
    Public tmAscent As Integer
    Public tmDescent As Integer
    Public tmInternalLeading As Integer
    Public tmExternalLeading As Integer
    Public tmAveCharWidth As Integer
    Public tmMaxCharWidth As Integer
    Public tmWeight As Integer
    Public tmOverhang As Integer
    Public tmDigitizedAspectX As Integer
    Public tmDigitizedAspectY As Integer
    Public tmFirstChar As Byte
    Public tmLastChar As Byte
    Public tmDefaultChar As Byte
    Public tmBreakChar As Byte
    Public tmItalic As Byte
    Public tmUnderlined As Byte
    Public tmStruckOut As Byte
    Public tmPitchAndFamily As Byte
    Public tmCharSet As Byte
End Structure

Public Structure PointF
    Public X As Single
    Public Y As Single
End Structure

Public Structure DispParams
    Public rgvarg As IntPtr
    Public rgdispidNamedArgs As IntPtr
    Public cArgs As UInteger
    Public cNamedArgs As UInteger
End Structure

Public Structure ExcepInfo
    Public wCode As UShort
    Public wReserved As UShort
    <MarshalAs(UnmanagedType.BStr)> _
    Public bstrSource As String
    <MarshalAs(UnmanagedType.BStr)> _
    Public bstrDescription As String
    <MarshalAs(UnmanagedType.BStr)> _
    Public bstrHelpFile As String
    Public dwHelpContext As UInteger
    Public pvReserved As IntPtr
    Public pfnDeferredFillIn As ExceptionInFoDeferredFillInDelegate
    Public scode As UInteger
End Structure

Public Structure InterfaceData
    <MarshalAs(UnmanagedType.LPArray)> _
    Public pmethdata() As MethodData
    Public cMembers As UInteger
End Structure

Public Structure MethodData
    <MarshalAs(UnmanagedType.BStr)> _
    Public szName As String
    <MarshalAs(UnmanagedType.LPArray)> _
    Public ppdata() As ParamData
    Public dispid As Integer
    Public iMeth As UInteger
    Public cc As CallConv
    Public cArgs As UInteger
    Public wFlags As UShort
    Public vtReturn As IntPtr
End Structure

Public Structure ParamData
    <MarshalAs(UnmanagedType.BStr)> _
    Public szName As String
    Public vt As IntPtr
End Structure

Public Structure TypeDesc
    Public UnionMember As IntPtr
    Public vt As UShort
End Structure

Public Structure SafeArrayBound
    Public cElements As UInteger
    Public lLbound As Integer
End Structure

Public Structure ArrayDesc
    Public tdescElem As TypeDesc
    Public cDims As UShort
    <MarshalAs(UnmanagedType.LPArray, SizeConst:=1)> _
    Public rgbounds As SafeArrayBound
End Structure

Public Structure CustDataItem
    Public guid As Guid
    Public varValue As IntPtr
End Structure

Public Structure CustData
    Public cCustData As UInteger
    <MarshalAs(UnmanagedType.LPArray)> _
    Public prgCustData() As CustDataItem
End Structure

Public Structure ElemDesc
    Public tdesc As UInteger
    Public UnionMember As IntPtr
End Structure

Public Structure FuncDesc
    Public memid As Integer
    Public lprgscode As IntPtr
    Public lprgelemdescParam As ElemDesc
    Public funckind As FuncKind
    Public invkind As InvokeKind
    Public callconv As CALLCONV
    Public cParams As Short
    Public cParamsOpt As Short
    Public oVft As Short
    Public cScodes As Short
    Public elemdescFunc As ElemDesc
    Public wFuncFlags As UShort
End Structure

Public Structure ParamDesc
    Public pparamdescex As ParamDescEx
    Public wParamFlags As UShort
End Structure

Public Structure ParamDescEx
    Public [cByte] As UInteger
    Public varDefaultValue As IntPtr
End Structure

Public Structure TypeAttr
    Public guid As Guid
    Public lcid As Guid
    Public dwReserved As UInteger
    Public memidConstructor As Integer
    Public memidDestructor As Integer
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public lpstrSchema As String
    Public cbSizeInstance As UInteger
    Public typekind As TypeKind
    Public cFuncs As UShort
    Public cVars As UShort
    Public cImplTypes As UShort
    Public cbSizeVft As UShort
    Public cbAlignment As UShort
    Public wTypeFlags As TypeFlags
    Public wMajorVerNum As UShort
    Public wMinorVerNum As UShort
    Public tdescAlias As TypeDesc
    Public idldescType As IDLDESC
End Structure

Public Structure IdlDesc
    Public dwReserved As UInteger
    Public wIDLFlags As IdlFlags
End Structure

Public Structure VarDesc
    Public memid As Integer
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public lpstrSchema As String
    Public UnionMember As IntPtr
    Public elemdescVar As ElemDesc
    Public wVarFlags As VarFlags
    Public varkind As VarKind
End Structure

Public Structure TLibAttr
    Public guid As Guid
    Public LCID As UInteger
    Public SYSKIND As SysKind
    Public wMajorVerNum As UShort
    Public wMinorVerNum As UShort
    Public wLibFlags As UShort
End Structure

<StructLayout(LayoutKind.Explicit)> _
Public Structure BindPtr
    <FieldOffset(0)> _
    Public lpfuncdesc As IntPtr
    <FieldOffset(0)> _
    Public lptcomp As IntPtr
    <FieldOffset(0)> _
    Public lpvardesc As IntPtr
End Structure

Public Structure PropSpec
    Public ukind As PropSpecType
    Public UnionMember As IntPtr
End Structure

Public Structure PropVariant
    Public vt As UInteger
    Public wReserved1 As UShort
    Public wReserved2 As UShort
    Public wReserved3 As UShort
    Public UnionMember As IntPtr
End Structure

Public Structure RemSNB
    Public ulCntStr As UInteger
    Public ulCntChar As UInteger
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public rgString() As String
End Structure

Public Structure StatPropSetStg
    Public fmtid As Guid
    Public clsid As Guid
    Public grfFlags As PropSetFlags
    Public mtime As FileTime
    Public ctime As FileTime
    Public atime As FileTime
End Structure

Public Structure StatPropStg
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public lpwstrName As String
    Public propid As Guid
    Public vt As UInteger
End Structure

Public Structure StatStg
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public pwcsName As String
    Public type As StgTy
    Public cbSize As ULong
    Public mtime As FILETIME
    Public ctime As FILETIME
    Public atime As FILETIME
    Public grfMode As UInteger
    Public grfLocksSupported As UInteger
    Public clsid As Guid
    Public grfStateBits As UInteger
    Public reserved As UInteger
End Structure

Public Structure StgOptions
    Public usVersion As UShort
    Public reserved As UShort
    Public ulSectorSize As UInteger
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public pwcsTemplateFile As String
End Structure

Public Structure StorageLayout
    Public LayoutType As StgTy
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public pwcsElementName As String
    Public cOffset As Long
    Public cBytes As Long
End Structure

Public Structure SerializedPropertyValue
    Public dwType As UInteger
    <MarshalAs(UnmanagedType.LPArray, ArraySubType:=UnmanagedType.U1, SizeConst:=1)> _
    Public rgb() As Byte
End Structure

Public Structure ApplicationProcessRecycleInfo
    <MarshalAs(UnmanagedType.Bool)> _
    Public IsRecyclable As Boolean
    <MarshalAs(UnmanagedType.Bool)> _
    Public IsRecycled As Boolean
    Public TimeRecycled As FileTime
    Public TimeToTerminate As FileTime
    Public RecycleReasonCode As Integer
    <MarshalAs(UnmanagedType.Bool)> _
    Public IsPendingRecycle As Boolean
    <MarshalAs(UnmanagedType.Bool)> _
    Public HasAutomaticLifetimeRecycling As Boolean
    Public TimeForAutomaticRecycling As FileTime
    Public MemoryLimitInKB As UInteger
    Public MemoryUsageInKBLastCheck As UInteger
    Public ActivationLimit As UInteger
    Public NumActivationsLastReported As UInteger
    Public CallLimit As UInteger
    Public NumCallsLastReported As UInteger
End Structure

Public Structure ApplicationProcessStatistics
    Public NumCallsOutstanding As UInteger
    Public NumTrackedComponents As UInteger
    Public NumComponentInstances As UInteger
    Public AvgCallsPerSecond As UInteger
    Public Reserved1 As UInteger
    Public Reserved2 As UInteger
    Public Reserved3 As UInteger
    Public Reserved4 As UInteger
End Structure

Public Structure ApplicationProcessSummary
    Public PartitionIdPrimaryApplication As Guid
    Public ApplicationIdPrimaryApplication As Guid
    Public ApplicationInstanceId As Guid
    Public ProcessId As UInteger
    Public Type As ComPlusAppType
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public ProcessExeName As String
    <MarshalAs(UnmanagedType.Bool)> _
    Public IsService As Boolean
    <MarshalAs(UnmanagedType.Bool)> _
    Public IsPaused As Boolean
    <MarshalAs(UnmanagedType.Bool)> _
    Public IsRecycled As Boolean
End Structure

Public Structure ApplicationSummary
    Public ApplicationInstanceId As Guid
    Public PartitionId As Guid
    Public ApplicationId As Guid
    Public Type As ComPlusAppType
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public ApplicationName As String
    Public NumTrackedComponents As UInteger
    Public NumComponentInstances As UInteger
End Structure

Public Structure ComEventSysChangeInfo
    Public cbSize As UInteger
    Public changeType As EOC_ChangeType
    <MarshalAs(UnmanagedType.BStr)> _
    Public objectId As String
    <MarshalAs(UnmanagedType.BStr)> _
    Public partitionId As String
    <MarshalAs(UnmanagedType.BStr)> _
    Public applicationId As String
    <MarshalAs(UnmanagedType.LPArray, SizeConst:=10)> _
    Public reserved As Guid
End Structure

Public Structure ComponentHangMonitorInfo
    <MarshalAs(UnmanagedType.Bool)> _
    Public IsMonitored As Boolean
    <MarshalAs(UnmanagedType.Bool)> _
    Public TerminateOnHang As Boolean
    Public AvgCallThresholdInMs As UInteger
End Structure

Public Structure ComponentStatistics
    Public NumInstances As UInteger
    Public NumBoundReferences As UInteger
    Public NumPooledObjects As UInteger
    Public NumObjectsInCall As UInteger
    Public AvgResponseTimeInMs As UInteger
    Public NumCallsCompletedRecent As UInteger
    Public NumCallsFailedRecent As UInteger
    Public NumCallsCompletedTotal As UInteger
    Public NumCallsFailedTotal As UInteger
    Public Reserved1 As UInteger
    Public Reserved2 As UInteger
    Public Reserved3 As UInteger
    Public Reserved4 As UInteger
End Structure

Public Structure ComponentSummary
    Public ApplicationInstanceId As Guid
    Public PartitionId As Guid
    Public ApplicationId As Guid
    Public Clsid As Guid
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public ClassName As String
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public ApplicationName As String
End Structure

Public Structure ComSvcsEventInfo
    Public cbSize As UInteger
    Public dwPid As UInteger
    Public lTime As Long
    Public lMicroTime As Integer
    Public perfCount As Long
    Public guidApp As Guid
    <MarshalAs(UnmanagedType.LPWStr)> _
    Public sMachineName As String
End Structure

Public Structure CrmLogRecordRead
    Public dwCrmFlags As UInteger
    Public dwSequenceNumber As UInteger
    Public blobUserData As Blob
End Structure

<StructLayout(LayoutKind.Explicit)> _
Public Structure PROCESS_HEAP_ENTRY
    <FieldOffset(0)> _
    Public lpData As IntPtr
    <FieldOffset(4)> _
    Public cbData As UInteger
    <FieldOffset(7)> _
    Public cbOverhead As Byte
    <FieldOffset(8)> _
    Public iRegionIndex As Byte
    <FieldOffset(9)> _
    Public wFlags As UShort
    <FieldOffset(11)> _
    Public hMem As IntPtr
    <FieldOffset(15)> _
    Public dwReserved1 As UInteger
    <FieldOffset(19)> _
    Public dwReserved2 As UInteger
    <FieldOffset(23)> _
    Public dwReserved3 As UInteger
    <FieldOffset(11)> _
    Public dwCommittedSize As UInteger
    <FieldOffset(15)> _
    Public dwUnCommittedSize As UInteger
    <FieldOffset(19)> _
    Public lpFirstBlock As IntPtr
    <FieldOffset(23)> _
    Public lpLastBlock As IntPtr
End Structure

Public Structure XACTOPT
    Public ulTimeout As UInteger
    <MarshalAs(UnmanagedType.LPArray, ArraySubType:=UnmanagedType.U1, SizeConst:=40)> _
    Public szDescription() As Byte
End Structure

Public Structure XACTTRANSINFO
    Public uow As Guid
    Public isoLevel As IsolationLevel
    Public isoFlags As IsoFlag
    Public grfTCSupported As UInteger
    Public grfRMSupported As UInteger
    Public grfTCSupportedRetaining As UInteger
    Public grfRMSupportedRetaining As UInteger
End Structure

Public Structure XID
    Public formatID As Integer
    Public gtrid_length As Integer
    Public bqual_length As Integer
    <MarshalAs(UnmanagedType.LPArray, ArraySubType:=UnmanagedType.I1, SizeConst:=128)> _
    Public data() As SByte
End Structure

Public Structure BOID
    <MarshalAs(UnmanagedType.LPArray, ArraySubType:=UnmanagedType.U1, SizeConst:=16)> _
    Public rgb() As Byte
End Structure